unit garantikarti;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ppBands, ppBarCod, ppVar, ppPrnabl, ppClass, ppCtrls, ppCache,
  ppProd, ppReport, ppDB, ppComm, ppRelatv, ppDBPipe, Db, ADODB,
  LMDCustomControl, LMDCustomPanel, LMDCustomBevelPanel, LMDBaseEdit,
  LMDCustomEdit, LMDEdit, LMDControl, LMDBaseControl,
  LMDBaseGraphicControl, LMDBaseLabel, LMDCustomLabel, LMDLabel;

type
  TForm1 = class(TForm)
    Button1: TButton;
    gds: TDataSource;
    garanti: TADOQuery;
    ppDBPipeline1: TppDBPipeline;
    ppReport1: TppReport;
    ppTitleBand1: TppTitleBand;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppDBText2: TppDBText;
    ppVariable1: TppVariable;
    ppDBText3: TppDBText;
    ppVariable2: TppVariable;
    ppDBBarCode1: TppDBBarCode;
    ppDBBarCode2: TppDBBarCode;
    ppDBText1: TppDBText;
    ppDBText4: TppDBText;
    ppFooterBand1: TppFooterBand;
    LMDEdit1: TLMDEdit;
    LMDLabel1: TLMDLabel;
    ppDBPipeline2: TppDBPipeline;
    procedure Button1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure LMDEdit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses data;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
garanti.Close;
garanti.Parameters.ParamByName('Serinos').value:=Trim(LMDEdit1.Text);
garanti.open;

     dm.spdevam.Close;
     dm.spdevam.Parameters.ParamByName('@serino').value:=Trim(LMDEdit1.Text);
     dm.spdevam.open;

  dm.spuretim.close;
  dm.spuretim.Parameters.ParamByName('@makinano').value:=dm.spdevam.fieldbyname('Makinano').asstring;
  dm.spuretim.open;

  dm.spStok.close;
  dm.spStok.Parameters.ParamByName('@StokKod').value:=dm.spuretim.FieldByName('uretimkod').Asinteger;
  dm.spStok.open;

  if garanti.RecordCount<>0 then
        begin
        ppReport1.Print;
        end;
    LMDEdit1.SetFocus;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
   LMDEdit1.SetFocus;
end;

procedure TForm1.LMDEdit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
        if key=13 then
        begin
        Button1.Setfocus;
             Button1Click(sender);

        end;
end;

end.
